<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<c:choose>
	<c:when test="${fn:length(account.cart.items) > 0 }">
		<form method="post" action="cart">
			<table class="tableCart">
				<thead class="tableCartTitle">
					<tr>
						<th class="tableCartTitleName"><h2>
								<spring:message code="productname" />
								<span></span>
							</h2></th>
						<th class="tableCartTitlePrice"><h2>
								<spring:message code="productprice" />
								<span></span>
							</h2></th>
						<th class="tableCartTitleQuantity"><h2>
								<spring:message code="productquantity" />
								<span></span>
							</h2></th>
						<th class="tableCartTitlePrice"><h2>
								<spring:message code="productsum" />
								<span></span>
							</h2></th>
						<th class="tableCartTitleAway"><h2>
								<spring:message code="remove" />
								<span></span>
							</h2></th>
					</tr>
				</thead>
				<tbody>
					<c:forEach var="item" items="${account.cart.items}">
						<input type="hidden" name="productId" value="${item.product.id}" />
						<tr class="tableCartItem">

							<td><a
								href="<c:url value="/product?id=${item.product.id}"/>">${item.product.name}</a></td>
							<td class="cartPrice"><fmt:formatNumber type="number"
									value="${item.product.price}" groupingUsed="true" /> VNĐ</td>

							<td><input class="cartQuantity" name="quantity"
								type="number" min="1" max="99999" value="${item.quantity}" /></td>
							<td class="cartPrice"><fmt:formatNumber type="number"
									value="${item.product.price * item.quantity}"
									groupingUsed="true" /> VNĐ</td>
							<td><input class="cartCheckbox" type="checkbox"
								name="removed" value="${item.product.id}" /></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			<input class="btnSubmitInCart" type="submit"
				value="<spring:message code="update" />" /> <input id="btnCheckout"
				class="btnSubmitInCart" form="checkout" type="submit"
				value="<spring:message code="checkout" />" />
		</form>
		<h1 class="cartTotal">
			<spring:message code="total" />
			:
			<fmt:formatNumber type="number" value="${account.cart.total}"
				groupingUsed="true" />
			VNĐ
		</h1>
	</c:when>
	<c:otherwise>
		<h1 class="cartTotal">
			<spring:message code="message.empty_cart" />
		</h1>
	</c:otherwise>
</c:choose>

<form id="checkout" action="checkout" method="post"></form>